<extend name="Public:base" />

<block name="content">
	
<div class="page-header">
<a href="{:U('Config/add')}" class="btn btn-primary">新增</a>

</div>		
	
<table class="table table-striped table-bordered table-hover search-form">
	<thead>
		<th><input name="name" type="text" placeholder="输入配置名称" value="{:I('name')}" /></th>
		<th>    				
			<select name="config_group">
				<option value="">-选择分组-</option>
				<option <?php if(isset($get_group)&&($get_group=='site')){echo ' selected="selected"';} ?> value="site">site</option>
				<option <?php if(isset($get_group)&&($get_group=='image')){echo ' selected="selected"';} ?> value="image">image</option>
				<option <?php if(isset($get_group)&&($get_group=='smtp')){echo ' selected="selected"';} ?> value="smtp">smtp</option>
				<option <?php if(isset($get_group)&&($get_group=='other')){echo ' selected="selected"';} ?> value="other">other</option>
			</select>
		</th>
		<th>
			<a class="btn btn-primary" href="javascript:;" id="search" url="{:U('Config/index')}">查询</a>
		</th>
	</thead>
</table>	
	
<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>											
						<th>名称</th>
						<th>分组</th> 
						<th>值</th>  		
						<th>描述</th>  				
						<th>操作</th>				
					</tr>
				</thead>
				<tbody>
						<volist name="list" id="c" empty="$empty">
						<tr>							
							<td>{$c.name}</td>
							<td>{$c.config_group}</td>
							<td>{$c.value}</td>		
							<td>{$c.info}</td>						
							<td>
								<a  class="btn btn-xs btn-info" href='{:U("Config/edit",array("id"=>$c["id"]))}'>
									<i class="icon-edit bigger-120"></i>
								</a> 
								<a class="delete btn btn-xs btn-danger" href='{:U("Config/del",array("id"=>$c["id"]))}' >
									<i class="icon-trash bigger-120"></i>
								</a>
							</td>
						</tr>
						</volist>	
						
						<tr>
							<td colspan="20" class="page">{$page}</td>
						</tr>
				</tbody>
				
			</table>
		</div>
	</div>
</div>
</block>
<block name="javascript">
<script>
$(function(){
	
	$("#search").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });
	
	
});		
</script>
</block>